package com.poker.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@Configuration
public class ApplicationConfig extends WebMvcConfigurerAdapter {

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        /*locations:指定springboot去何处查找资源;
          Handler:指定什么样的请求路径Springboot才会处理请求;*/
        registry.addResourceHandler("/**")
                .addResourceLocations("classpath:/static/")
                .addResourceLocations("classpath:/public/")
                .addResourceLocations("classpath:/resources/")
                .addResourceLocations("classpath:/META-INF/resources/");

//        registry.addResourceHandler("/upload/**")
//                .addResourceLocations("file:E:/upload/");
        registry.addResourceHandler("/upload/**")
                .addResourceLocations("file:/usr/local/upload/");
                //.addResourceLocations("file:/usr/local/upload/");
                //.addResourceLocations("file:/usr/local/upload/");
                //.addResourceLocations("file:E:/upload/");

        super.addResourceHandlers(registry);
    }
}